@echo off
call setenv.bat

If "%JAVA_HOME%" == ""  goto notOkHome
IF NOT EXIST "%JAVA_HOME%" goto notOkHome

set CURRENT_DIR=%cd%
set CLASSPATH=%CLASSPATH%;%JAVA_HOME%;%CURRENT_DIR%/lib/junit-4.10.jar;
set EXECUTEJAVA=java


IF NOT EXIST jasssystem.jar goto noJarFound
echo Running All Unit Test
%EXECUTEJAVA% -classpath "jasssystem.jar;%CLASSPATH%" org.junit.runner.JUnitCore sg.edu.nus.iss.jass.AllTests

echo Running App
cd %CURRENT_DIR% 
%EXECUTEJAVA% -classpath "jasssystem.jar;%CLASSPATH%" sg.edu.nus.iss.jass.gui.MainFrame
cd %CURRENT_DIR% 
goto end

:notOkHome
echo JAVA NOT AVAILABLE , Please set the JAVA_HOME in setenv.bat
goto end

:noJarFound
echo jasssystem.jar NOT AVAILABLE , PLEASE run compile.bat
:end
